<template>
   <el-form-item v-if="showControls" :label="i18nt('designer.setting.controlsPosition')">
    <el-select v-model="controlsPosition">
      <el-option :label="i18nt('designer.setting.olDefaultCtrlPos')" value="default"></el-option>
      <el-option :label="i18nt('designer.setting.olRightCtrlPos')" value="right"></el-option>
    </el-select>
  </el-form-item>
</template>

<script>
  import i18n from "@/utils/i18n"

  export default {
    name: "controlsPosition-editor",
    mixins: [i18n],
    props: {
      designer: Object,
      selectedWidget: Object,
      optionModel: Object,
    },
    computed: {
      showControls() {
        return this.optionModel.controls === undefined ? true : this.optionModel.controls
      },
      
      controlsPosition: {
        get() {
          if (!this.optionModel.controlsPosition) {
            return 'default'
          }
          
          return this.optionModel.controlsPosition
        },
        
        set(newValue) {
          if (newValue === 'default' || !newValue) {
            this.optionModel.controlsPosition = ''
          } else {
            this.optionModel.controlsPosition = 'right'
          }
        }
      },
      
    }
    
  }
</script>

<style scoped>

</style>
